package com.edu.service.impl;

import java.util.List;

import com.edu.bean.Orders;
import com.edu.bean.Ordersdata;
import com.edu.bean.Page;
import com.edu.dao.OrdersDao;
import com.edu.dao.UserDao;
import com.edu.dao.impl.OrdersDaoImpl;
import com.edu.dao.impl.UserDaoImpl;
import com.edu.service.OrdersService;

public class OrdersServiceImpl implements OrdersService {
	OrdersDao od = new OrdersDaoImpl();
	UserDao ud = new UserDaoImpl();
	@Override
	public Page<Orders> selectAllorder(Orders order,int pageNum,int pageSize) {
		List<Orders> orderpage=od.selectAll(pageNum, pageSize);
		int rows=od.selectAllorder(order);
		int usertotal=ud.selectUsers();
		int ordertotal = od.selectpriceAll();
		Page<Orders> page=new Page(orderpage,pageNum, pageSize,rows,usertotal,ordertotal);
		return page;
	}
	@Override
	public int deleteOrderById(int orderid) {
		// TODO Auto-generated method stub
		return od.deleteOrderById(orderid);
	}
	@Override
	public int updateOrders(Orders order) {
		// TODO Auto-generated method stub
		return od.updateOrders(order);
	}
	@Override
	public Orders selectOrdersById(int orderid) {
		// TODO Auto-generated method stub
		return od.selectOrdersById(orderid);
	}
	@Override
	public Ordersdata<Orders> selecttotal() {
		int January = od.sleectonetotal();
		int February = od.sleecttwototal();
		int March = od.sleectthreetotal();
		int April = od.sleectfourtotal();
		int May = od.sleectfivetotal();
		int June = od.sleectsixtotal();
		int July = od.sleectseventotal();
		int August = od.sleecteighttotal();
		int September = od.sleectninetotal();
		int October = od.sleecttentotal();
		int November = od.sleecteleventotal();
		int December = od.sleecttwelvetotal();
		Ordersdata<Orders> ordersdata=new  Ordersdata(January,February,March,April,May,June,July,August,September,October,November,December);
		return ordersdata;
	}
	@Override
	public Page<Orders> selectAllorders(Orders order, int pageNum, int pageSize) {
		List<Orders> orderpage=od.selectAll(pageNum, pageSize);
		int rows=od.selectAllorder(order);
		Page<Orders> page=new Page(orderpage,pageNum, pageSize,rows);
		return page;
	}

}
